<script>
export default {
  name: "PinkCard",
  props: {
    notice: {
      type: Object,
      default: function () {
        return {};
      }
    },
    title: {
      type: String,
      default: function () {
        return 'Lorem ipsum dolor sit amet consectetur adipisicing elit.'
      }
    },
    content: {
      type: String,
      default: function () {
        return 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Recusandae\n' +
            '        dolores, possimus pariatur animi temporibus nesciunt praesentium'
      }
    },
    user: {
      type: String,
      default: function () {
        return 'Lorem ipsum dolor sit amet consectetur adipisicing elit.'
      }
    },
    current: {
      type: String,
      default: function () {
        return 'Lorem ipsum dolor sit amet consectetur adipisicing elit.'
      }
    },
  },
  methods: {
    // 查看公告详情
    viewDetail(e) {
      const name = JSON.stringify(e.name);
      const id = JSON.stringify(e.id);
      this.$router.push({
        path: "/user/notice_detail?id=" + id,
        query: {name},
      })
    }
  },

}
</script>

<template>
  <div class="card">
    <div class="image">
      <img src="../assets/swapper/jhk-1746198770845.png" style="object-fit: cover;" alt=" ">
    </div>
    <div class="content">
      <a href="#">
      <span class="title">
        {{ title }}
      </span>
      </a>

      <p class="desc">
        {{ content }}
      </p>

      <p class="desc">
        类型：{{ user }}
      </p>

      <p class="desc">
        分布时间： {{ current }}
      </p>

      <span class="action" href="#" @click="viewDetail(notice)">
        <span>查看详情</span>
        <span aria-hidden="true"> →</span>
      </span>
    </div>
  </div>
</template>

<style scoped>
.card {
  max-width: 600px;
  border-radius: 0.5rem;
  background-color: #fff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid transparent;
}

.card:hover {
  transition: all ease-in-out 0.3s;
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(222, 222, 222, 0.9);
}

.card a {
  text-decoration: none
}

.content {
  padding: 1.1rem;
}

.image {
  object-fit: cover;
  width: 100%;
  height: 150px;
  /*background-color: rgb(239, 205, 255);*/
  background-color: #6a7d50;
}

.title {
  color: #111827;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.desc {
  margin-top: 0.5rem;
  color: #6B7280;
  font-size: 0.875rem;
  line-height: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.action {
  cursor: pointer;
  display: inline-flex;
  margin-top: 1rem;
  color: #ffffff;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  width: 100%;
  background-color: #545f46;
  padding: 4px 8px;
  border-radius: 4px;
}

.action span {
  transition: .3s ease;
}

.action:hover span {
  transform: translateX(4px);
}

</style>